package com.hqyj.springcloud.service.impl;

import com.hqyj.springcloud.mapper.PaymentMapper;
import com.hqyj.springcloud.pojo.Order;
import com.hqyj.springcloud.pojo.Payment;
import com.hqyj.springcloud.service.PaymentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class PaymentServiceImpl implements PaymentService {
    @Autowired
    private PaymentMapper paymentMapper;

    @Override
    public boolean addPayment(Order order){
        boolean result = false;
        Payment payment = new Payment();
        payment.setPayment_name("美团外卖");
        payment.setPayment_amount(order.getOrder_amount());
        int insertPayment = paymentMapper.insertPayment(payment);
        if(insertPayment > 0) {
            result = true;
        }
        return result;
    }
}
